package com.ibm.ems.servlets;

import java.io.IOException;
import java.sql.Connection;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ibm.ems.dao.FeedbackDAO;
import com.ibm.ems.util.ConnectionUtil;

public class SubmitFeedbackServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public SubmitFeedbackServlet() {
		super();

	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		
		Connection conn = ConnectionUtil.getConnection();
		String eventID = request.getParameter("eventId");
		//System.out.println(eventID);
		String feedback = request.getParameter("feedback");
		//System.out.println(feedback);
		
		FeedbackDAO fd = new FeedbackDAO(conn); 
		fd.submitFeedback(eventID, feedback);
		ConnectionUtil.closeConnection(conn);
		request.getRequestDispatcher("/FeedbackServlet").forward(request, response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

	}

}
